Some Improvements

So the first commit fixes a bug with my old Pull Request, the second is a simple code improvement ((int) is faster than intval()) and the two last are self explained ;)