API bugs fixed

Fixed all JSON/API related bugs