Bug fix

crashing due to null reference exception . Fixed