Fixing some bugs and adjust arguments