Adding the fixState function