Fixed condition issue in old orm