fix bug in many_to_many tables