Fix action handler logic and syntax bugs that could cause vm state check not to run at all