This fixes 3 issues, fix #41, fix #49 and fix #62