changes to throw exception if st!=ds