more fixes to invalid IDs - close #607