Minior bug fixes