Fixed bugs on logic checks