Added bound checks for activation variables