Fixing null rootPath in image element