Fix some type specs and errors