fixed some issues

See pull request for comments