fixed some bugs and friend parameter added