Fixed warnings and errors