Merged changes from the upstream version 'v1.3.5'

@piscisaureus Would you like to review? There were few conflicts I had to resolve, run `git show 48f3105` to see them.