Some improvements and bug fixes

salam
Tozihato to commit ha neveshtam, faghat to method add chon ye seri moshkel vojod dasht on ro be halat asli php bargar dondam va method sub ro ezafe kardam.