Issue 328: bug 2 & 4 fixed