fixed top max infinite loop