Fixed the shape added bug by adding checks.