fixing rexp function