bug fixed and protections