Corrected mismatched if-else-endif arguments