added better detection to imageSplitting