Modified to fit v1.4+ functionality
Adding waiting for transition and hopefully fix the bug
merge master
Apply master patch