Fix bug in draw_space to not access memory outside the space buffer