Correcting slider javascript