Fix an bug and add the ligin check