add boundary checks