Use of undefined constant and wrong test for constant