change infinite loop to allow disable function trap to register