fixed preload image function