Some fixes for beartraps