fix bug with ajax call