Added check for free space