Fixed some memory error