fix maximum recursion error