fixed error in dispatch and error in free