modified getVal()