Fixing some issues for running on data