Fixed seg fault with image return refs