Fixed populate

Changes from registrationMerged branch and repaired populate script.