Fixed a possible bug in the main.lua library