Fix order of operations for request validity check