Minor bug fix in code