Linked stages, fixed some bugs