more fixes to querySelector for invalid IDs - close #586