Pull req. 253 and unit test fixes