adapt server side code