Bug fixes for issues #71, #75, #77 and #78