SPY-274 fixes HIVE-2332 in code copied into Shark

see https://github.com/clearstorydata/hive/commit/e176cb209c88d460442a17d4ee9be46c2aedf9f5