added tests and fixed bugs with defaults