Important bug fixes on the DS generation