fixed bug in models with related names