Fixing elsif bug