Simplifying has2d and has3d check