added get_write_space()