Fix ereg functions