bug fixes #52, #53, #54, #60, #68