fix problems with references