Fix getDocument type bug