Fixed dependency bugs in api lib