Fix bug; add ajax interface