Fixes a hidden bug in image uploading