Update main.m

returns -1 on error