Added helper function to fix JavaScript