improved write test