fix maximum recursion limit error