Fixing bug https://whale.fe.up.pt/redmine/issues/2318