oops, this function is actually not IO-safe