Fix that allows parsing some files that normally break

Based on code found elsewhere (cited the link in one of the commits)