Fix API misuse errors