Making contexts immutable and fixing #23