updated database model and corrected some bugs in api_raf.py