forgot to add error code to the function