made changes to motif counter and bug