Functions to support memory corruption fix