to prevent loss of modifs
Solved a couple of bugs