Fixes for issues #84, #119 and #120