corrected empty polygon and added getVertex function