made typing with error checks correct