Clearing ManyToMany association doesn't work. I needed to clear the roles of the user (after form submit) and then add the checked roles. Also counting them doesn't work properly.
See the clearRoles method in the attachment.
//EDIT: Don't know if it's important but the association is bidirectional.