refactored test
implement flush() fix #7