added empty check to prevent errors