Fixed music looping incorrectly and some other bugs