remove setTimeout and use dfd.rejectOnError and dfd.callback