fixing ajax functionality