assign errors correctly