Merging from master (haiyang's changes)