Fixed: Loops throw errors when the array is empty.

Signed-off-by: Alexander Kastius <alexander.kastius@student.hpi.uni-potsdam.de>