fix to issue 8, + certain bug fixes