Fix a bug in pre_build hook