fixed #35, #42, #46