Fixed bug with API