Minor bug fix. Still not perfect :(.