Compilation crash fix and optmization reported error fix.