Fixes a bug with the  function.