Fixes #111. Also fixes bugs with strange map filenames.