added correct error code for duplicate.