fixed global ajax functions, and added working registration/login