Fixed 500 error in API.