bug fixed for nil