Fixed some bugs on client and serverside