code tweaking to tackle timing issue for ajax call
merged changed