Fixed two bugs
Merge branch 'master' into 1.8