Fix #13356. Clean up after load/ready handlers. Close gh-1152.