Fixed crash problem, other tweaks