fix server internal error in api.php by broff