Fix #1 bug and added parse cookies

we should check type of `$cookies`.