work in Progress
fix some testbugs
add dataprovider to cover more test cases

Change-Id: Iee65bc990fb8b3e580c8cfb6f69a1d89e13aa7da