Fixed bugs with RestAPI.