Fixed issues #52 and #58