fix #41 and start to work on #49