Fixed sort bug and added check for endianess.
Added basic checks for human demography.