Bug fixes for negative tests to work correctly