fix some safe issues