diff --git a/Distribution/MacOSX.hs b/Distribution/MacOSX.hs
--- a/Distribution/MacOSX.hs
+++ b/Distribution/MacOSX.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings #-}
 {- | Cabal support for creating Mac OSX application bundles.
 
 GUI applications on Mac OSX should be run as application /bundles/;
@@ -27,7 +28,16 @@
 import Prelude hiding ( catch )
 import Control.Monad (forM_, when, filterM)
 import Data.List ( isPrefixOf )
-import Data.String.Utils (replace)
+import Data.Text ( Text )
+import System.Cmd (system)
+import System.Exit
+import System.FilePath
+import System.Info (os)
+import System.Directory (copyFile, createDirectoryIfMissing, doesDirectoryExist,
+                         getHomeDirectory)
+import qualified Data.Text as T
+import qualified Data.Text.IO as T
+
 import Distribution.PackageDescription (PackageDescription(..),
                                         Executable(..))
 import Distribution.Simple
@@ -38,12 +48,6 @@
                                  )
 import Distribution.Simple.Utils (installDirectoryContents, installExecutableFile)
 import Distribution.Verbosity (normal)
-import System.Cmd (system)
-import System.FilePath
-import System.Info (os)
-import System.Directory (copyFile, createDirectoryIfMissing, doesDirectoryExist,
-                         getHomeDirectory)
-import System.Exit
 
 import Distribution.MacOSX.AppBuildInfo
 import Distribution.MacOSX.Common
@@ -119,16 +123,24 @@
 bundleScriptElsewhere :: LocalBuildInfo -> MacApp -> String
 bundleScriptElsewhere localb app = unlines
   [ "#!/bin/bash"
-  , "COUNTER=0"
   , "MAX_DEPTH=256"
+  , "COUNTER=0"
   , "ZERO=$0"
-  , "NZERO=`readlink $ZERO`; STATUS=$?"
+  , "STATUS=0"
   , ""
   , "# The counter is just a safeguard in case I'd done something silly"
   , "while [ $STATUS -eq 0 -a $COUNTER -lt $MAX_DEPTH ]; do"
-  , "  let COUNTER=COUNTER+1"
-  , "  ZERO=$NZERO"
+  , "  COUNTER=$(($COUNTER+1))"
   , "  NZERO=`readlink $ZERO`; STATUS=$?"
+  , "  if [ $STATUS -eq 0 ]; then"
+  , "      # go to my parent dir"
+  , "      pushd $(dirname $ZERO)  > /dev/null"
+  , "      # now follow the symlink if at all"
+  , "      pushd $(dirname $NZERO) > /dev/null"
+  , "      ZERO=$PWD/$(basename $NZERO)"
+  , "      popd > /dev/null"
+  , "      popd > /dev/null"
+  , "  fi"
   , "done"
   , "if [ $COUNTER -ge $MAX_DEPTH ]; then"
   , "  echo >&2 Urk! exceeded symlink depth of $MAX_DEPTH trying to dereference $0"
@@ -199,9 +211,9 @@
     Nothing -> case appIcon app of
                  Just icPath ->
                    do -- Need a plist to support icon; use default.
-                     let pl = replace "$program" (appName app) plistTemplate
-                         pl' = replace "$iconPath" (takeFileName icPath) pl
-                     writeFile plDest pl'
+                     let pl  = T.replace "$program"  (T.pack (appName app)) plistTemplate
+                         pl' = T.replace "$iconPath" (T.pack (takeFileName icPath)) pl
+                     T.writeFile plDest pl'
                      return ()
                  Nothing -> return () -- No icon, no plist, nothing to do.
     where plDest = appPath </> "Contents/Info.plist"
@@ -251,7 +263,7 @@
 
 -- | Default plist template, based on that in macosx-app from wx (but
 -- with version stuff removed).
-plistTemplate :: String
+plistTemplate :: Text
 plistTemplate = "\
     \<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
     \<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">\n\
diff --git a/Distribution/MacOSX/AppBuildInfo.hs b/Distribution/MacOSX/AppBuildInfo.hs
--- a/Distribution/MacOSX/AppBuildInfo.hs
+++ b/Distribution/MacOSX/AppBuildInfo.hs
@@ -1,3 +1,4 @@
+-- | Information used to help create an application bundle
 module Distribution.MacOSX.AppBuildInfo where
 
 import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
@@ -11,11 +12,16 @@
 --   macosx-app executable without it necessarily having to
 --   know a lot of Cabal internals
 data AppBuildInfo = AppBuildInfo
-  { abAppPath    :: FilePath
+  { -- | Location of the application bundle being built
+    abAppPath    :: FilePath
+    -- | Location of the original executable that was built
   , abAppOrigExe :: FilePath
+    -- |
   , abApp        :: MacApp
   }
 
+-- | @toAppBuildInfo l m@ returns information for an application bundle
+--   within the @l@ build directory
 toAppBuildInfo :: LocalBuildInfo -> MacApp -> AppBuildInfo
 toAppBuildInfo localb app = AppBuildInfo
   { abAppPath    = buildDir localb </> appName app <.> "app"
diff --git a/Distribution/MacOSX/Common.hs b/Distribution/MacOSX/Common.hs
--- a/Distribution/MacOSX/Common.hs
+++ b/Distribution/MacOSX/Common.hs
@@ -1,3 +1,4 @@
+-- | Utility functions
 module Distribution.MacOSX.Common where
 
 import Data.List
diff --git a/cabal-macosx.cabal b/cabal-macosx.cabal
--- a/cabal-macosx.cabal
+++ b/cabal-macosx.cabal
@@ -1,5 +1,5 @@
 Name:                   cabal-macosx
-Version:                0.2.2
+Version:                0.2.3
 Stability:              Alpha
 Synopsis:               Cabal support for creating Mac OSX application bundles.
 Description:
@@ -21,7 +21,7 @@
 License-file:           LICENSE
 Copyright:              Eric Kow & Andy Gimblett
 Author:                 Eric Kow <eric.kow@gmail.com> & Andy Gimblett <haskell@gimbo.org.uk>
-Maintainer:             Andy Gimblett <haskell@gimbo.org.uk>
+Maintainer:             Eric Kow <eric.kow@gmail.com>
 Homepage:               http://github.com/gimbo/cabal-macosx
 Build-Type:             Simple
 Cabal-Version:          >=1.6
@@ -33,7 +33,7 @@
 Library
   Build-Depends:   base >= 4 && < 5, Cabal >= 1.6, directory
                ,   fgl >= 5.4.2.2 && < 5.5
-               ,   filepath, MissingH, parsec, process
+               ,   filepath, parsec, process, text
   Exposed-modules: Distribution.MacOSX
   Other-modules:   Distribution.MacOSX.Common,
                    Distribution.MacOSX.AppBuildInfo,
@@ -45,4 +45,4 @@
   Main-is:         macosx-app.hs
   Build-Depends:   base >= 4 && < 5, Cabal >= 1.6, directory
                ,   fgl >= 5.4.2.2 && < 5.5
-               ,   filepath, MissingH, parsec, process
+               ,   filepath, parsec, process, text
