Corrected some bugs, some more to correct