Fixed reference type bug