fix backend stackoverflow bug