Fixed http://pastebin.ca/2317608