fix terminals and generalize them