bug fixes for issue #49