Fix for issue #12 and issue #11. (hooh solution)