update memory for apc and fix bug