fix node order for sequence/EOF nodes

Make sure that sequence nodes always sort before EOF nodes. Closes #242.