Fix bug where images could not be deletede