fixed some issues as per pull requests comments