tryed to fix some bugs, but stil in progress ...