fixed some bugs server side