Fix check for out-of-range slot numbers (issue #5)