Fixe #57 Variables not always replaced in assignments plus fixed a
couple of other minor bugs noticed in passing