fixed memory free error