added flush() method