Fixed casting issue from the previous commit.