fixed middleware for weather function