added tests too. fix #3