Fix some warnings and errors