Handle undefined properly