fixed stupid if bug