fixed strange bug with nil