Implemented fix from #660

Fixes the issue #660.

---Auto issue closing message below----
Closes #660