complete fix for all functions
Merge pull request #1 from Tjeerdo/master

complete fix for all functions