fix erroneously doing a test inside a function