Fixes for Issue#308 Added test cases
fixes for Issue#308 reverted unnecessary changes