add spacing support and bug fixed

add spacing support and bug fixed