fixed #10, fixed #11, fixed #12, update tests