Commit taken from [1]. [1] https://github.com/lnls-dig/halcs/commit/2d4b7670c46b684fec8348bfb59b39723335a260