added error check to setOnEmpty