Enhancing stability by tuning element ratio in 2D transition metal chalcogenides