fixed some problems in safe