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 75ba20d` to see them.