Added tests for refetch flag / fix bugs found