fixes error when there's no input for belongstomanyt