adding test + bug correction