Corrected some issues highlighted by code analysis