5.2 bugs fixed

Issues 1, 2 and 5 fixed.
Merge branch '5.2-bug-fixes'