Fix bugs caused by upgrading the target sdk to 19