fix header bugs
add try catch for unsafe logic