fixed refresh function with data