Fix uid changing if no remote candidate has been found.
Fix error with automatic flag setting.

Do not set automatic flag for local packages unless it is really needed.