minor edit to beg js