fixed allocation/deallocation type mismatch error