Fix some enabling optimisations bugs.