bug fix and refactoring
api url changed