Added DataOutputStream flushing