Post #1170: )
The code works for me (cube stays in object mode).