added checkSpace