I think you should try to achieve the same thing but better call parent::write() somewhere... Not sure how to resolve this though.