Fixed bug with memory references and er registers