Replace lastSuccessfulBuild by lastBuild (rebased onto develop)



This is the same as gh-216 but rebased onto develop.

----