bug fixes on refresh fn