Fixed an undefined variable bug with the API