Use references to fix crash