Fixed a scope in the if-else