Fixed all static analysis problems