Minor bug and code conventions