Fixed SQL to handle null columns. #264.