Fixing compiler errors and warning