updated api class; small bugfixes.