Fixed bug in api