Fixed crash due to new API changes