Fix code audit issues