Fixing some type specs and old API usage