moved middleware initialization independent to its db connection state, release 0.0.4