Equal case returning zero causes fatal error (maximum function nesting levels). Can't find the solution.