type and error handling