clean code warning and fix mirror bugs

resolves #16