fixed some writeStorage issues