Use safe functions to get open pages