Fixed minor bugs on server side