Incorrect function being called