Small changes, some bugs fixed