imagep() improvement (issue 414)