added objectOutput.flush(); after every write.