Lots of minor fixes / changes

Possibly to increase code stability (fixes some findbug high priority warnings)