Fix some bugs, Type 1 not 100%.