Fix #1431 and also fix some type information and reference paths