bug fixes and RED file adjustment