Corrected out-of-bounds check

Change-Id: Ib012ac66b0b8d93dd199dac8093c5dcf3df3078b
Reviewed-on: https://iffwww.iff.kfa-juelich.de/review/73
Reviewed-by: Josef Heinen <j.heinen@fz-juelich.de>