resolving infinite loop