fixed saving pictures logic