fixed initialization of res to grab Resources to prevent NullPointerException