fixing ajax

still needs improvement