Fix issues #119 and #132