runs better with key off

Put the O2 sensor in.

Your car isn't running right because it doesn't have all the parts installed.