Fixed logical problems