Limit switch self triggering when L298 driver is used with motor

Do you have pull up (or pull down) resistors in place?