fixed it with a undefined check