Do some safe checking.