Fixed warnings
Fixed cast