Fix #578, move helper to correct file