fix for inf loop