fixed some bugs. added params