more robust serve handler