Minor fixes to the code