Fixes Crash and removes Unused variable