fix some parsing bugs + export