Fixed bugs introduced by the recent restruct.