This should probably be checking element.width and element.height, pos is a vector, and doesn't have w/h properties.