fixing crash when using different datasets