Fixing warnings and errors