Necessary error-checking