Fix image loading from char buffer