Pull request for #53 and #61

This PR fixes #53 and #61.