Fix ereg functions

Thanks.