The ends justify the means?

«The ends justify the means» (Niccolo Machiavelli). Either Machiavelli was wrong, or the morality has changed since then. I stick to the opinion, there is no goal important enough to justify disgraceful means of achieving it (the quote supposedly belongs to Einstein)