Fix for Safari. Using parseInt instead of Number.parseInt