Fixed get_free_space for the case of an empty buffer.