finished type systems fixes