bugfix and added test file