fixed if else issue