add check to prevent error