fix PHP warnings while running build-api.php

this commit fixes #475