speed issue fix for large trial datasets