draw: improved handling of undefined inputs