Fixed bugs in foreman