Fixed some logical things