Fixed a bug in exec code