Fixed handling of null images