handles png and gif correctly