Added more exception handling to deal with bad frames