Fixed public template
Fixed some bugs