Fix input argument sanitization

The s2id argument wasn't properly sanitized, so if you passed text in,
later codepaths would complain about non-numeric inputs. This ensures
that s2id is numeric before we use it.