Fixed reference saving bug