Fixed some bugs found during execution.