Weird solution to function not seen