Fixed bug in API