Fixed intermediate.ml issues