add helper function for trace