Add some error-checking.