fixes various warnings, makes parser slightly more robust