Fixed bug in before_build hook