Fixed casting error