fixed nil-delegate problem