Fix related to issues #31, #51, #63