added a range check when the chest inventory gets opened!