lua: fix post-image-import not working for imgid >255