fix a bug and improve the security.