Cleanup some warnings and fix some unit tests