Fixes for 5.0 and 4.8
Merge pull request #4 from pamval/master

Fixes for 5.0 and 4.8