Fixes for code hardening