fixed substition bug