fixed bug to add state argument in write variable function call