some bug fixes
Merge origin/master