Fix compile warnings, remove unused var