use local vars, thanks @kambfhase