Declare $wp_version;

At least on my local server, version_compare() doesn't work if I don't declare global $wp_version.