bugfix & testcases added