Changed write return value
changed tests