Small bug fix for undefined result