Fixing issues with api listener