improved complete ajax behaviour