messed around with some stuff, write() returns strange stuff