Bug fix: fixed the right if case