Fixed mobile check in middleware