Fixed issues #26 and #23

This pull requests has two commits for issues #26 and #23. Thanks!