Fix bug on chrome, change everything to javascript