Fixed issue with console messages in case of error.

Console was not being flushed when a CommandFailedException was thrown, and messages did not show up on the console in that case
Merge branch 'master' into SprintRelease