fixed some bugs and added parameters as default.
fixed some bugs and added parameters as default