added nil protection