Set the standalone flag before using it

This reorders imports and delays them after the args are processed.