Small fix on encrypt javascript funcion to improve firefox compatibility