add check for undefined input