handle empty images properly