fixing null reference exception introduced in last commit