added possible fix to disfunctioning javascript