removed unused assignment
fix problem with if statement