fix cors problem and db migrations and change some js logic