Make changes in functions after HIVE-3984 + fix tests