Sync https://github.com/neo-project/neo-vm/pull/309
Sync neo-project/neo-vm#309