Fixed trap cleanup handling.