CRM-14215 - misc ajax related fixes & cleanup