Various pull request and issue fixes