fixed up some functions and getCount fails right after the alert.