Fix CID 1134506
Fix CID 1134511
Fix CID 1134851
Fix CID 1135045 and some GCC warnings
Fix CID 1135070 and some GCC warnings