Don't trust the user coming in

@antgonza, can you review please?

fixes #733