bug fix for crash