Preventing bad codes