diff --git a/snd/music.lua b/snd/music.lua
index 6bb30db..ca5a44e 100644
--- a/snd/music.lua
+++ b/snd/music.lua
@@ -7,7 +7,7 @@
 --    combat  - Player just got a hostile on screen.
 --    idle    - Current playing music ran out.
 --]]--
-
+last = "idle"
 function choose(str)
   if str == "load" then
     music.load("machina")
@@ -25,10 +25,12 @@ function choose(str)
     music.load("galacticbattle")
     music.play()
 
-  elseif str == "idle" then
+  elseif str == "idle" and last ~= "idle" then
     choose(last) -- This should be smarter in the future.
   end
 
-  last = str -- Save the last string so we can use it.
+  if last ~= "idle" then
+    last = str -- Save the last string so we can use it.
+  end
 end
 
diff --git a/src/music.c b/src/music.c
index 5a5738a..12987c1 100644
--- a/src/music.c
+++ b/src/music.c
@@ -371,6 +371,8 @@ static int music_luaInit(void) {
 
   music_lua = luaL_newstate();
 
+  luaL_openlibs(music_lua);
+
   lua_loadSpace(music_lua, 1);  // Space and time are readonly.
   lua_loadTime(music_lua, 1);
   lua_loadRnd(music_lua);