Fixed issues #23 and #22