move defer above beforeFn && update README