Fix issues #54 and #57