fixed static code analysis errors; thanks to @pgbi