updated code to try to fix ER status