fixing the images issues with clip function