null check is ugly