added update sql check date
fixed a minor formal bug