fix #36 and make search for &foo; better