Add more input validation

It might be clearer if there was only one object in each of these. Otherwise it's not immediately clear which link is invalid.