fixed bug in api.rb