Fixed invalid invalid write fix