facebook api call fix and refactoring