Fix bugs and add security.