Wrong variable was set to -1 on compiler error