Fixing some warnings and errors