fixes and enhancements for merged pull request