diff --git a/flag.inc b/flag.inc
index ca2b914..8c0a2a8 100644
--- a/flag.inc
+++ b/flag.inc
@@ -63,7 +63,7 @@ function flag_flag_definitions_alter(&$definitions) {
  * Returns a flag definition.
  */
 function flag_fetch_definition($content_type = NULL) {
-  static $defintions;
+  $defintions = &drupal_static(__FUNCTION__);
   if (!isset($defintions)) {
     $defintions = module_invoke_all('flag_definitions');
     drupal_alter('flag_definitions', $defintions);
@@ -88,7 +88,7 @@ function flag_fetch_definition($content_type = NULL) {
  * Returns all flag types defined on the system.
  */
 function flag_get_types() {
-  static $types;
+  $types = &drupal_static(__FUNCTION__);;
   if (!isset($types)) {
     $types = array_keys(flag_fetch_definition());
   }
diff --git a/flag.module b/flag.module
index 1018702..f318975 100644
--- a/flag.module
+++ b/flag.module
@@ -1421,7 +1421,7 @@ function flag_theme() {
  */
 function template_preprocess_flag(&$variables) {
   global $user;
-  static $initialized = array();
+  $initialized = &drupal_static(__FUNCTION__, array());
 
   // Some typing shotcuts:
   $flag =& $variables['flag'];
@@ -1558,7 +1558,7 @@ function _flag_link_type_fields() {
  *   An array of the structure [name] => [number of flags].
  */
 function flag_get_counts($content_type, $content_id, $reset = FALSE) {
-  static $counts;
+  $counts = &drupal_static(__FUNCTION__);
 
   if ($reset) {
     $counts = array();
@@ -1594,7 +1594,7 @@ function flag_get_counts($content_type, $content_id, $reset = FALSE) {
  *   Reset the internal cache and execute the SQL query another time.
  */
 function flag_get_flag_counts($flag_name, $reset = FALSE) {
-  static $counts;
+  $counts = &drupal_static(__FUNCTION__);
 
   if ($reset) {
     $counts = array();
@@ -1656,7 +1656,7 @@ function flag_get_flag($name = NULL, $fid = NULL) {
  *   An array of the structure [fid] = flag_object.
  */
 function flag_get_flags($content_type = NULL, $content_subtype = NULL, $account = NULL, $reset = FALSE) {
-  static $flags;
+  $flags = &drupal_static(__FUNCTION__);
 
   // Retrieve a list of all flags, regardless of the parameters.
   if (!isset($flags) || $reset) {
@@ -1869,7 +1869,7 @@ function flag_get_content_id($fcid) {
  *
  */
 function flag_get_user_flags($content_type, $content_id = NULL, $uid = NULL, $sid = NULL, $reset = FALSE) {
-  static $flagged_content;
+  $flagged_content = &drupal_static(__FUNCTION__);
 
   if ($reset) {
     $flagged_content = array();
@@ -2007,7 +2007,7 @@ function flag_create_link($flag_name, $content_id) {
  * @see hook_flag_link_types_alter()
  */
 function flag_get_link_types($reset = FALSE) {
-  static $link_types;
+  $link_types = &drupal_static(__FUNCTION__);
 
   if (!isset($link_types) || $reset) {
     $link_types = array();
@@ -2051,7 +2051,7 @@ function flag_check_token($token, $content_id) {
  * Set the Session ID for a user. Utilizes the Session API module.
  */
 function flag_set_sid($uid = NULL, $create = TRUE) {
-  static $sids = array();
+  $sids = &drupal_static(__FUNCTION__, array());
 
   if (!isset($uid)) {
     $uid = $GLOBALS['user']->uid;
diff --git a/flag_actions.module b/flag_actions.module
index 6a06880..91b7396 100644
--- a/flag_actions.module
+++ b/flag_actions.module
@@ -76,7 +76,7 @@ function flag_actions_get_action($aid) {
 }
 
 function flag_actions_get_actions($flag_name = NULL, $reset = FALSE) {
-  static $flag_actions;
+  $flag_actions = &drupal_static(__FUNCTION__);
   module_load_include('inc', 'flag', 'includes/flag.actions');
 
   // Get a list of all possible actions defined by modules.
diff --git a/includes/flag.views.inc b/includes/flag.views.inc
index 2c3402d..4f85ffd 100644
--- a/includes/flag.views.inc
+++ b/includes/flag.views.inc
@@ -241,7 +241,7 @@ function flag_views_flag_config_form($form_type, $content_type, $current_flag) {
  * Helper function that gets the first defined flag and returns its name.
  */
 function flag_views_flag_default($content_type) {
-  static $default_flag = array();
+  $default_flag = &drupal_static(__FUNCTION__, array());
 
   if (!array_key_exists($content_type, $default_flag)) {
     $flag = array_shift(flag_get_flags($content_type));
