added stdin flush at end ofplay