fixed bug in  api method