merge some of the pmod fixes from issues. and try to apply the same to error_t