Fixed string bug, fixed memory issues

#454