Added free space checking, some fixed