Crash fix and Tests fix