write context bugfix