Some fixes in code