fix notice_count function