the api checkfperr could be implemented in terms of this to save a few duplicated lines.