Added typecheckStageWithEmtpy
and made typecheckStage a proper one