avoid off by one error when query database
add TODO
support call all upload tasks