add some minimal input checks, misc de-derpings