bugfix and tests added