some code fixes
Merge origin/master