Fix for infinite loop in FF