fixed duplicate requests bug and some null checking