fixes #2151 by moving the related code into common-util which seems to fix it