fix server logic