fixes for issues #14, #11, #8