Added a counter pref and a fix for the imapid