fixes in tests, local mode and global mode