Fixed error caused by relationships