CHANGED fixed some bugs