fixes issues #22 and #23