added some fail safes to prevent problems with drag n drop logic.