Fix static analyzer errors