Fix issues #41 and #42