WriteHandler and some fixes