Fixed some errors after merge with API.