a version that uploads images correctly