bugfix for reference saving