bug fixing for ajax call