Updated a bug with the workarround 

There was a bug with the workarround when using immediateButtons.