Fixed condition bug

Fixed issue #1