Compiler error in debug configuration, wrong variables referenced