Fixed bug due to missing cast.