a lot of compiler warning fixes

I've fixed all compiler warnings and one bug.
it just stupid