Fixed issue: A more stable code