diff --git a/flag.inc b/flag.inc
index d552926..51df079 100644
--- a/flag.inc
+++ b/flag.inc
@@ -57,7 +57,7 @@ function flag_flag_type_info_alter(&$definitions) {
  * Returns a flag definition.
  */
 function flag_fetch_definition($entity_type = NULL) {
-  static $defintions;
+  $cache = &drupal_static(__FUNCTION__);
   if (!isset($defintions)) {
     $defintions = module_invoke_all('flag_type_info');
     drupal_alter('flag_type_info', $defintions);
@@ -82,7 +82,7 @@ function flag_fetch_definition($entity_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 cb2296f..b863f74 100644
--- a/flag.module
+++ b/flag.module
@@ -1361,7 +1361,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'];
@@ -1498,7 +1498,7 @@ function _flag_link_type_fields() {
  *   An array of the structure [name] => [number of flags].
  */
 function flag_get_counts($entity_type, $entity_id, $reset = FALSE) {
-  static $counts;
+  $counts = &drupal_static(__FUNCTION__);
 
   if ($reset) {
     $counts = array();
@@ -1534,7 +1534,7 @@ function flag_get_counts($entity_type, $entity_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();
@@ -1596,7 +1596,7 @@ function flag_get_flag($name = NULL, $fid = NULL) {
  *   An array of the structure [fid] = flag_object.
  */
 function flag_get_flags($entity_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) {
@@ -1809,7 +1809,7 @@ function flag_get_entity_id($flagging_id) {
  *
  */
 function flag_get_user_flags($entity_type, $entity_id = NULL, $uid = NULL, $sid = NULL, $reset = FALSE) {
-  static $flagged_content;
+  $flagged_content = &drupal_static(__FUNCTION__);
 
   if ($reset) {
     $flagged_content = array();
@@ -1947,7 +1947,7 @@ function flag_create_link($flag_name, $entity_id) {
  * @see hook_flag_link_type_info_alter()
  */
 function flag_get_link_types($reset = FALSE) {
-  static $link_types;
+  $link_types = &drupal_static(__FUNCTION__);
 
   if (!isset($link_types) || $reset) {
     $link_types = array();
@@ -1991,7 +1991,7 @@ function flag_check_token($token, $entity_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 b3bed68..5669eb8 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/views/flag.views.inc b/includes/views/flag.views.inc
index b4129dd..e8ab965 100644
--- a/includes/views/flag.views.inc
+++ b/includes/views/flag.views.inc
@@ -247,7 +247,7 @@ function flag_views_flag_config_form($form_type, $entity_type, $current_flag) {
  * Helper function that gets the first defined flag and returns its name.
  */
 function flag_views_flag_default($entity_type) {
-  static $default_flag = array();
+  $default_flag = &drupal_static(__FUNCTION__, array());
 
   if (!array_key_exists($entity_type, $default_flag)) {
     $flag = array_shift(flag_get_flags($entity_type));
