fixed warnings and some logic stuff