Update execute.cc

Fixed a few subtle bugs. Did not compile though since I am not home at the moment.