Proper determination of powers of two instead of popcount; Fixed typo an...

...d added test cases