Better handling of invalid IDs.