Minor bug fixes and syntax correction