add better support for setImageResource