Fixing bug with previous commit

Should have testd more thoroughly.