Apis, various bugfixes