implemented error checking when first code is special