removed casting from appdelegate