bug fix and unit tests for extension methods