Fixed all modal related and data_set creation bugs

Fix for #702
Fix for #703
Fix for #704