fix @before_first_request rasing exception

I tried using @before_first_request but ran into an AssertionError in @setupmethod because before actually executing the functions app.\_got_first_request was set to True indicating it's already too late. So I just moved it after the execution of the functions. Also I made the decorator leave the functions intact so they could be used directly.