Fixed issues #22 and #30.