fixed undefined rank and population errors