Fix some warnings, delete unused variables, resolve conversion conflicts.