Fixed bug with substitute of old properties. Switched to safe_substitute.