Fixed bugs in orphanage.