This may be due to undercooking. Check that the legumes have been sufficiently cooked before serving them.