Fix for MR-181

There appeared to be several different ways to solve this bug, this particular solution seemed the simplest and least intrusive. I've only just begun getting familiar with the code so please forgive me if this causes any unwanted side effects.

-Tom