Fixed two memory corruption issues in APLOD.