Add test case

Signed-off-by: Christoph Höger <christoph.hoeger@tu-berlin.de>
Fix some overflow problems

Signed-off-by: Christoph Höger <christoph.hoeger@tu-berlin.de>