several bug fixes, some hardcoded parameters still exists