Issue #145 related bugs fixed