Fixed core_remote_main return value
Fixed function scope and buffer len read error