made a small logic error with initialization