changed type detection in optimization